package com.itheima.servise.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.itheima.mapper.LogMapper;
import com.itheima.pojo.OperateLog;
import com.itheima.pojo.PageBean;
import com.itheima.pojo.QueryString;
import com.itheima.servise.LogServise;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LogServiseImpl implements LogServise {
    @Autowired
    private LogMapper logMapper;

    @Override
    public PageBean page(QueryString param) {
        PageHelper.startPage(param.getPage(), param.getPageSize());
        List<OperateLog> rows = logMapper.list(param);
        Page<OperateLog> p = (Page<OperateLog>) rows;
        return new PageBean(p.getTotal(), p.getResult());
    }
}
